﻿@model IEnumerable<QuanLyGiaoVuUI.Models.LopMonHoc.LopMonHocViewModel>

@{
    ViewBag.Title = "DanhSachLopDeNghiMo";
    Layout = "~/Views/Shared/_blueWhaleLayout.cshtml";
}

@{Html.RenderPartial("LopMonHocMenuPartial");}

<div id="main" class="grid_10">
    <!--  start page-heading -->

    <div id="page-heading" class="box round first grid">
        <h2>Danh sách lớp môn học do giảng viên đề nghị mở</h2>
        <!-- end page-heading -->
        <div class="block">
            <table class="data display datatable">
                <tr>
                    <th class="sorting"></th>
                    <th class="sorting">
                        @Html.DisplayNameFor(model => model.MaLopMonHoc)
                    </th>
                    <th class="sorting">Tên Môn học
                    </th>
                    <th class="sorting">
                        @Html.DisplayNameFor(model => model.MaGiangVien1)
                    </th>
                    <th class="sorting">Họ tên giảng viên 1
                    </th>
                    <th class="sorting">
                        @Html.DisplayNameFor(model => model.SiSoToiDa)
                    </th>
                    <th class="sorting">
                        @Html.DisplayNameFor(model => model.LoaiLop)
                    </th>
                    <th class="sorting">Tùy chọn
                    </th>
                </tr>
                @{int count = 0;}
                @foreach (var item in Model)
                {
                    <tr class="gradeA @(++count % 2 == 0 ? "even" : "odd")" id="@item.LopMonHocId">
                        <td>
                            <input type="checkbox" value="@item.LopMonHocId" />
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.MaLopDayDu)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.MonHoc.TenMonHoc)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.GiangVien1.MaGiangVien)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.GiangVien1.HoTenGV)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.SiSoToiDa)
                        </td>
                        <td>
                            @(item.LoaiLop == 0 ? "Lý Thuyết" : "Thực Hành")
                        </td>
                        <td>
                            <a href="javascript:;" onclick="XacNhanMoLop('@item.LopMonHocId',true)">Xác nhận</a> |
                <a href="#" onclick="XacNhanMoLop('@item.LopMonHocId',false)">Hủy</a>
                        </td>
                    </tr>
                }

            </table>
        </div>
    </div>
</div>
<script>
    function XacNhanMoLop(maLopMonHoc, xacNhanMo) {
        $.ajax({
            type: "POST",
            url: '/LopMonHoc/XacNhanMoLop',
            data: {
                maLopMonHoc: maLopMonHoc,
                dongYMo: xacNhanMo
            },
            success: function (data) {
                if (data.success)
                {
                    $("#" + maLopMonHoc).remove();
                }
            }

        });
    }
</script>
